package com.zl.tesseract.scanner.utils;

import android.content.Context;
import android.content.pm.PackageManager;

import com.zl.tesseract.scanner.app.MyApplication;

/**
 * 硬件信息工具类.
 * @author: zhangyan
 * @date: 2018/9/30
 */
public class HardwareUtil {

	/**
	 * 摄像头是否可用
	 * @return boolean
	 */
	public static boolean isCameraAvailable() {
		return MyApplication.sAppContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)
				|| MyApplication.sAppContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY);
	}


	/**
	 * 判断设备是否有闪光灯
	 * @return true-有，false-无
	 */
	public static boolean ishaveflash(Context context){
		return !context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
	}


}
